<?php
if (!defined('_THRIFT_CLIENT')) {
    define('_THRIFT_CLIENT', 1);
}

$GLOBALS['THRIFT_ROOT'] = 'lib/thrift';

require_once $GLOBALS['THRIFT_ROOT'] . '/Thrift.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/protocol/TBinaryProtocol.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TSocket.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TBufferedTransport.php';
require_once $GLOBALS['THRIFT_ROOT'] . '/transport/TFramedTransport.php';

abstract class ThriftClient{
  protected $_client_instance = null;
  protected $_socket = null;
  protected $_transport = null;
  protected $_protocol = null;

  public function OpenTransport(){
    if ($this->_transport != null)
    {
      $this->_transport->open();
      return true;
    } else 
      return false;
  }
  
  public function CloseTransport(){
    if ($this->_transport != null){
      $this->_transport->close();
      return true;
    } else 
      return false;
  }
  
  public function client(){
    return $this->_client_instance;
  }
}


